$(function(){registerIdentify();});
//注册信息验证函数
var registerIdentify = function(){
//注册提示格式
//picNum: 1 表示填写正确 2表示输入为空 3表示输入有误
var showtips = function(rclass,text,picNum){
	if(picNum == 1){
		$(rclass).css({'border-color':'#FFF','background-color':'#FFF','color':'#111','font-size':'0.9em','padding-left':'3px'});
		$(rclass).html(text);
	}
	if(picNum == 2){
		$(rclass).css({'border-color':'#C86','background-color':'#FEF','color':'#C03','font-size':'0.9em','padding-left':'3px'});
		$(rclass).html(text);
	}
	if(picNum == 3){
		$(rclass).css({'border-color':'#C86','background-color':'#FEF','color':'#C03','font-size':'0.9em','padding-left':'3px'});
		$(rclass).html(text);
	}
	}
//企业用户名验证
	VD_name = function(){
		$("#accountname").blur(function(){
			with(document.getElementById("accountname")){
				if(value.length < 1){
				showtips(".tips:eq(0)","请填写企业用户名",2);
				return false;
				}
				else if(value.length < 1 || value.length > 10){
				showtips(".tips:eq(0)","用户名填写有误,长度范围为1~10",3);
				return false;
				}
				else{
				showtips(".tips:eq(0)","填写正确",1);
				return true;
				}
			}
		});
	};
//密码验证
	VD_password1 = function(){
		$("#password1").blur(function(){
			with(document.getElementById("password1")){
				if(value.length < 1){
				showtips(".tips:eq(1)","请填写密码",2);
				return false;
				}
				else if(value.length > 20){
				showtips(".tips:eq(1)","密码填写有误，长度不得超过20",3);
				return false;
				}
				else{
				showtips(".tips:eq(1)","填写正确",1);
				return true;
				}
			}
		});
	};
//密码确认验证
	VD_password2 = function(){
		$("#password2").blur(function(){
			with(document.getElementById("password2")){
				if(value.length < 1){
				showtips(".tips:eq(2)","请确认密码",2);
				return false;
				}
				else if(value != document.getElementById("password1").value){
				showtips(".tips:eq(2)","两次密码输入不一致，请重新填写",3);
				return false;
				}
				else{
				showtips(".tips:eq(2)","填写正确",1);
				return true;
				}
			}
		});
	};
//企业名
	VD_enterprise_name = function(){
		$("#enterprise_name").blur(function(){
			with(document.getElementById("enterprise_name")){
				if(value.length < 1){
				showtips(".tips:eq(3)","请填写企业名",2);
				return false;
				}
				else{
				showtips(".tips:eq(3)","填写正确",1);
				return true;
				}
			}
		});
	};
//企业类型
	VD_enterprise_type = function(){
		$("#enterprise_type").blur(function(){
			with(document.getElementById("enterprise_type")){
				if(value.length < 1){
				showtips(".tips:eq(4)","请填写企业类型",2);
				return false;
				}
				else{
				showtips(".tips:eq(4)","填写正确",1);
				return true;
				}
			}
		});
	};
//企业链接
	VD_index_link = function(){
		$("#index_link").blur(function(){
			with(document.getElementById("index_link")){
				var http=value.indexOf("http://");
				var dotpos=value.indexOf(".com");
				if(value.length < 1){
				showtips(".tips:eq(5)","请填写企业链接",2);
				return false;
				}
				else if(dotpos-http<2){
				showtips(".tips:eq(5)","填写有误，请重新填写",3);
				return false;
				}
				else{
				showtips(".tips:eq(5)","填写正确",1);
				return true;
				}
			}
		});
	};
//企业详情
	VD_detail_info = function(){
		$("#enterprise_name").blur(function(){
			with(document.getElementById("detail_info")){
				if(value.length < 1){
				showtips(".tips:eq(6)","请填写企业详情",2);
				return false;
				}
				else{
				showtips(".tips:eq(6)","填写正确",1);
				return true;
				}
			}
		});
	};
	
	VD_name();
	VD_password1();
	VD_password2();
	VD_enterprise_name();
	VD_enterprise_type();
	VD_index_link();
	VD_detail_info();
}